<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['fafee']=pdo_getsum('jy_renwushop_feelog',array('uniacid'=>$_SESSION['uniacid'],'type'=>3,'createtime >'=>$daytime),'fee');
		$access['koufee']=pdo_getsum('jy_renwushop_renwuorder',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),'koufee');
		$access['zuofee']=pdo_getsum('jy_renwushop_feelog',array('uniacid'=>$_SESSION['uniacid'],'type'=>0,'createtime >'=>$daytime),'fee');
		$access['fafeeall']=pdo_getsum('jy_renwushop_feelog',array('uniacid'=>$_SESSION['uniacid'],'type'=>3),'fee');
		$access['koufeeall']=pdo_getsum('jy_renwushop_renwuorder',array('uniacid'=>$_SESSION['uniacid']),'koufee');
		$access['zuofeeall']=pdo_getsum('jy_renwushop_feelog',array('uniacid'=>$_SESSION['uniacid'],'type'=>0),'fee');
		$access['fenfee']=pdo_getsum('jy_commission_commission',array('uniacid'=>$_SESSION['uniacid'],'type'=>'jy_renwushop','createtime >'=>$daytime),'money');
		$access['fenfeeall']=pdo_getsum('jy_commission_commission',array('uniacid'=>$_SESSION['uniacid'],'type'=>'jy_renwushop'),'money');
		$access['fee']=$access['koufee']-$access['fenfee'];
		$access['feeall']=$access['koufeeall']-$access['fenfeeall'];
		//月份
		for($i=0;$i<12;$i++){
				if($i==0){
					$yuestart = mktime(0,0,0,date('m'),1,date('Y'));
					$yueend = time();
					
				}else{
					$yuestart = mktime(0,0,0,date('m')-$i,1,date('Y'));
					$yueend = mktime(0,0,0,date('m')-$i+1,1,date('Y'));
				}
				$params=array('uniacid'=>$_SESSION['uniacid']);
				$params['createtime between']=array($yuestart,$yueend);
				$month12[$i] = date('Y-m',strtotime('-'.$i.' month'));
				//$monthaccess[]=pdo_getsum('jy_renwushop_feelog',$params);
				$accessline[$i]=pdo_getsum('jy_renwushop_renwuorder',$params,'koufee');
				//$monthcredit2[]=pdo_getsum('core_members',$params,'credit2');
		}
		$accessline=array_reverse($accessline);
		$month12=array_reverse($month12);
		$return['htmls']=array(
				array('type'=>'data','one_num'=>2,'title'=>'应用今日/总数据指标','datas'=>array(
					array('title'=>'发任务额度','num'=>2,'data'=>array($access['fafee'],$access['fafeeall'])),
					array('title'=>'分销佣金额度','num'=>2,'data'=>array($access['fenfee'],$access['fenfeeall'])),
					array('title'=>'平台扣佣额度','num'=>2,'data'=>array($access['koufee'],$access['fenfeeall'])),
					array('title'=>'做任务发放额度','num'=>2,'data'=>array($access['zuofee'],$access['zuofeeall'])),
					array('title'=>'平台收入','num'=>2,'data'=>array($access['fee'],$access['feeall'])),
				)),
				array('type'=>'echarts_arealine','ecid'=>'mobile','title'=>'月度扣费数据','datas'=>array(
					'datas'=>array(
						array('name'=>'平台扣费收入','value'=>$accessline),
					),
					'xdatas'=>$month12,
				)),
	);
	exi($return);
}